<template>
  <div class="span auto compatible">
    <input class="entering form-control" type="text" v-model="model.f_typename">
    <button class="btu btn-success" @click = "add()">新增</button>
    <button class="btu btn-success" @click = "save()">保存</button>
  </div>
</template>

<script>
    export default {
      name: "save-info",
      props: {
        // 安检项id号
        itemId: {},
        //
        row: {
          type: Object
        }
      },
      data () {
        return {
          model: {
          }
        }
      },
      watch: {
        itemId (val) {
          this.model.f_type_id = val
        },
        row (val) {
          this.model = Object.assign({}, this.model, val)
        }
      },
      methods: {
        save () {
          this.$resetpost('rs/logic/saveinfo', {data: this.model}).then(()=>{
            this.$emit('commit')
          })
        },
        add () {
          this.model = {f_type_id: this.itemId}
        }
      }
    }
</script>

<style scoped>
  .entering{
    height:40px;
    width:200px;
    margin-left:20px;
    margin-right:20px;
    float:left;/*设置浮动，实现多列效果，div+Css布局中很重要的*/
  }
  .btu{
    margin-left: 20px;
    margin-top:7px;
    float:left;
  }
</style>
